package code04_循环结构;

import java.util.Scanner;

/*
 * 依次输入10名学生的考试成绩，输出前三名
 */
public class 练习2_while {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		int first = 0, second = 0, third = 0;

		int i = 1;
		while (i <= 10) {
			System.out.print("请输入第" + i + "个学生的考试成绩：");
			int score = input.nextInt();
			if (score > first) {
				third = second;
				second = first;
				first = score;
			} else if (score > second) {
				third = second;
				second = score;
			} else if (score > third) {
				third = score;
			}
			i++;
		}
		System.out.println("第一名：" + first);
		System.out.println("第二名：" + second);
		System.out.println("第三名：" + third);
	}
}
